<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:insert="~{include :: header('新增导航')}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
    <form class="form-horizontal m" id="form-navigate-add">
        <div class="form-group row">
            <label class="col-sm-2 col-form-label is-required text-sm-right">类型</label>
            <div class="col-sm-6">
                <select name="type" class="form-control m-b" required>
                    <option value="friend">友情链接</option>
                    <option value="tab">底部导航</option>
                    <option value="footer">手机导航</option>
                </select>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label is-required text-sm-right">名称</label>
            <div class="col-sm-6">
                <input name="name" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label is-required text-sm-right">跳转地址</label>
            <div class="col-sm-6">
                <input name="url" class="form-control" type="text" required>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label text-sm-right">在新页面打开</label>
            <div class="col-sm-6 form-text">
                <th:block th:each="dict ,cStat: ${@dict.getType('qdx_navigate_newpage')}">
                    <input type="radio" th:id="${'newpage_' + dict.dictCode}" name="newPage" th:value="${dict.dictValue}" th:checked="${cStat.index == 0}">
                    <label th:for="${'newpage_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </th:block>
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 col-form-label text-sm-right">排序</label>
            <div class="col-sm-4">
                <input name="orderNum" class="form-control" type="sort" value="0">
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label text-sm-right">导航图片</label>
            <div class="col-sm-9">
                <textarea name="image" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:insert="~{include :: footer}" />
<script type="text/javascript">
    var prefix = "/navigate"
    $("#form-navigate-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add.json", $('#form-navigate-add').serialize());
        }
    }
</script>
</body>
</html>